package leetcode.code1014;

public class Solution {

	public int maxScoreSightseeingPair(int[] values) {
		int ans = -1, max = values[0];
		for (int i = 0; i < values.length; i++) {
			int val = values[i];
			int cur = max + val - i;
			ans = Math.max(ans, cur);
			max = Math.max(max, val + i);
		}
		return ans;
	}
}
